package com.cg.ggkt.vod.controller;

import com.cg.ggkt.domain.ResponseData;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author caigang
 * @description: TODO
 */
@RestController
@RequestMapping("/admin/vod/user")
@CrossOrigin  //跨域
public class UserLoginController {

    // login
    @PostMapping("login")
    public ResponseData login(){
        // {code: 20000, data: {token: "admin-token"}}
        Map<String, Object> map = new HashMap<>();
        map.put("token", "admin-token");
        System.out.println("用户登录");
        ResponseData<Map<String, Object>> ok = ResponseData.ok(map);
        System.out.println(ok);
        return ok;
    }

    //info
    @GetMapping("info")
    public ResponseData info(){
        // {code: 20000, data: {roles: ["admin"], introduction: "I am a super administrator",…}}
        //code: 20000
        //data: {roles: ["admin"], introduction: "I am a super administrator",…}
        //avatar: "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif"
        //introduction: "I am a super administrator"
        //name: "Super Admin"
        //roles: ["admin"]
        Map<String, Object> map = new HashMap<>();
        map.put("roles", "admin");
        map.put("introduction", "I am a super administrator");
        map.put("avatar", "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        map.put("name", "Super Admin");
        return ResponseData.ok(map);
    }
}
